<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <div th:insert="commen/head :: header">
    </div>
</head>
<body style="background-color: rgb(242,244,247);">
<div th:insert="commen/navigationBar :: topNavBar"></div>
<div class="container" style="background-color: #fff;margin-top: 20px;border-radius: 2%;padding: 30px; padding-top: 20px;">
    <div class="row">
        <div class="col-md-12">
            <span style="font-size: 24px; font-weight: bold;" th:text="${homework.getHomeworkName()}"></span>
            <br>
            <span th:if="${homework.getHomeworkStatus() == 0}" style="font-size: 18px; color:red;">作业已截止！！</span>
        </div>
        <div class="col-md-12" th:if="${homework.getHomeworkStatus() == 1 || homeworkState == 1}">
            <form th:action="@{/submitQuestion}" method="post" th:if="${homeworkState==0}">
                <input type="hidden" name="id" th:value="${id}">
                <input type="hidden" name="homeworkId" th:value="${homework.getHomeworkId()}">
                <input type="hidden" name="choiceQuestionCount" th:value="${choiceQuestionCount}">
                <input type="hidden" name="answerQuestionCount" th:value="${answerQuestionCount}">
                <div th:if="${choiceQuestions != null}">
                    <div th:each="choiceQuestion : ${choiceQuestions}" style="border: #5e5e5e 1px solid; border-radius: 5px; margin-top: 5px; padding: 10px;">
                        <span style="font-size: 18px; font-weight: bold;">题目:</span>
                        <span style="font-size: 18px; font-weight: bold;" th:text="${choiceQuestion.getCqTitle()}"></span><br>
                        <span style="font-size: 18px;">A: </span><span style="font-size: 18px;" th:text="${choiceQuestion.getCqA()}"></span><br>
                        <span style="font-size: 18px;">B: </span><span style="font-size: 18px;" th:text="${choiceQuestion.getCqB()}"></span><br>
                        <span style="font-size: 18px;">C: </span><span style="font-size: 18px;" th:text="${choiceQuestion.getCqC()}"></span><br>
                        <span style="font-size: 18px;">D: </span><span style="font-size: 18px;" th:text="${choiceQuestion.getCqD()}"></span><br>
                        <span style="font-size: 18px;">你的答案:</span><select style="font-size: 18px" name="cqSelect" id="">
                            <option>A</option>
                            <option>B</option>
                            <option>C</option>
                            <option>D</option>
                        </select>
                        <input type="hidden" name="cqCorrect" th:value="${choiceQuestion.getCqCorrect()}">
<!--                        正确答案: <span th:text="${choiceQuestion.getCqCorrect()}"></span>-->
                    </div>
                </div>
                <div th:if="${answerQuestions != null}">
                    <div th:each="answerQuestion : ${answerQuestions}" style="border: #5e5e5e 1px solid; border-radius: 5px; margin-top: 5px; padding: 10px;">
<!--                        <span th:text="${answerQuestion.getAnswerQuestionKey()}"></span>||||-->
                        <input type="hidden" name="answerQuestionKey" th:value="${answerQuestion.getAnswerQuestionKey()}">
                        <span style="font-size: 18px;">题目: </span><span style="font-size: 18px;" th:text="${answerQuestion.getAnswerQuestionContent()}"></span><br>
                        <span style="font-size: 18px;">你的答案: </span><br>
                        <textarea name="myAnswerQuestionKey" class="form-control" rows="4" placeholder="做答区"></textarea>
                    </div>
                </div>
                <div class="text-center" style="margin-top: 10px;">
                    <button style="width: 100px;" class="btn btn-success" id="putForm" type="submit">提交</button>
                </div>
            </form>

            <form action="" th:if="${homeworkState == 1}">
                <div th:if="${choiceQuestions != null}">
                    <div th:each="choiceQuestion : ${choiceQuestions}" style="border: #5e5e5e 1px solid; border-radius: 5px; margin-top: 5px; padding: 10px;">
                        <span style="font-size: 18px; font-weight: bold;">题目:</span>
                        <span style="font-size: 18px; font-weight: bold" th:text="${choiceQuestion.getCqTitle()}"></span><br>
                        <span style="font-size: 18px;">A: </span><span style="font-size: 18px;" th:text="${choiceQuestion.getCqA()}"></span><br>
                        <span style="font-size: 18px;">B: </span><span style="font-size: 18px;" th:text="${choiceQuestion.getCqB()}"></span><br>
                        <span style="font-size: 18px;">C: </span><span style="font-size: 18px;" th:text="${choiceQuestion.getCqC()}"></span><br>
                        <span style="font-size: 18px;">D: </span><span style="font-size: 18px;" th:text="${choiceQuestion.getCqD()}"></span><br>
                        <span style="font-size: 18px; font-weight: bold;">正确答案: </span><span th:text="${choiceQuestion.getCqCorrect()}"></span>
                    </div>
                </div>
                <div th:if="${answerQuestions != null}">
                    <div th:each="answerQuestion : ${answerQuestions}" style="border: #5e5e5e 1px solid; border-radius: 5px; margin-top: 5px; padding: 10px;">
                        <input type="hidden" name="answerQuestionKey" th:value="${answerQuestion.getAnswerQuestionKey()}">
                        <span style="font-size: 18px; font-weight: bold;">题目: </span><br>
                        <span style="font-size: 18px;" th:text="${answerQuestion.getAnswerQuestionContent()}"></span><br>
                        <span style="font-size: 18px; font-weight: bold;">答案: </span><br>
                        <span style="font-size: 18px;" th:text="${answerQuestion.getAnswerQuestionKey()}"></span><br>
                        <span style="font-size: 18px; font-weight: bold;">解析: </span><br>
                        <span style="font-size: 18px;" th:text="${answerQuestion.getAnswerQuestionAnalysis()}"></span><br>
                    </div>
                </div>
            </form>
        </div>

    </div>
</div>
<script>
    let putForm = document.getElementById("putForm");
    putForm.onclick = function () {
        putForm.onsubmit();

    }
</script>
</body>
</html>